﻿@model Windvoice.Albums.Album
@using Windvoice.Albums         
@{
    ViewBag.Title = "Album Detail";
    Layout = "~/Areas/Manage/Views/Shared/_Layout.cshtml";
}

@section headSection{
    <script type="text/javascript">
        $(function () {
            $('ul').find('img').redraw(192, 108);
            $('a[data-delete]').click(function () { $(this).handledelete('/manage/photo/delete') });
            $('a[data-face]').click(function () {
                var photoID = $(this).data('face');
                $.post('/manage/photo/setfacephoto', { 'photoid': photoID }, function (data) {
                    if (data.result.toString().toLowerCase() == 'false')
                        alert('设置失败:' + data.message);
                    else
                        window.location.reload();
                }, 'json')
            });
        });
    </script>
}

<div class="pagetitle">
    <h2>相册详情 - @Model.AlbumName</h2>
    <div class="pagefunctions">
        @Html.ActionLink("返回列表", "index")
    </div>    
</div>

<ul class="photo-list">
    @foreach (var photo in (Photo[])ViewBag.PhotoList)
    {
        <li>
            <a href="javascript:;" class="image">
                <img class="photo" src="@photo.SmallPath"/>
            </a>
            <div class="content">
                <div class="description">@photo.Description</div>
                <div class="operate">
                    <a href="javascript:;" data-delete="@photo.ID">删除</a>
                    <a href="/manage/photo/edit/@photo.ID">修改</a>
                    @if (Model.FacePhoto != photo.ID)
                    {
                        <a href="javascript:;" data-face="@photo.ID">设为封面</a>
                    }
                </div>
            </div>
        </li> 
    }
    <div class="clear"></div>
</ul>